package org.iabako.client.ui.page.user;

import org.iabako.client.config.page.PageConfigEnum;
import org.iabako.client.ui.form.user.enterprise.MyEnterpriseConfigForm;
import org.iabako.client.ui.form.user.enterprise.MyEnterpriseForm;
import org.iabako.client.ui.layout.field.IField;
import org.iabako.client.user.AuthenticateUserProvider;
import org.iabako.shared.entity.business.AbstractEntity;
import org.iabako.shared.entity.user.Enterprise;
import org.iabako.shared.exception.IabakoActionForbiddenException;

import java.util.List;

/**
 * Created by jose on 15/01/15.
 */
public class MyEnterprise extends MyEnterpriseForm {

    public MyEnterprise() throws IabakoActionForbiddenException {
        super(PageConfigEnum.EnterpriseConfiguration);

        if (AuthenticateUserProvider.getUser().getEnterprise().isDemo()) {
            throw new IabakoActionForbiddenException("action_disable_for_demo_title", "action_disable_for_demo_text", true);
        }

        setEnterprise(AuthenticateUserProvider.getUser().getEnterprise());
    }
}
